{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "np.random.seed(2)\n",
    "large_matrix = np.random.randint(-100, 100, size=(1000, 1000))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 68, -85, -28, ...,   6, -82,  71],\n",
       "       [ 55,   8, -13, ...,  49,  79,  66],\n",
       "       [-43, -59,  61, ...,   2,  -2,  98],\n",
       "       ...,\n",
       "       [ 31,  15,  85, ..., -69, -78,  46],\n",
       "       [-84, -23,  75, ..., -59,  42,  40],\n",
       "       [ 71,  56, -28, ...,  76,  31, -48]])"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "large_matrix"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "if __name__ == '__main__':\n",
    "    for i in range(1, np.size(large_matrix, 0)-1):\n",
    "        for j in range(1, np.size(large_matrix, 1)-1):\n",
    "            surrounding_crd = [(x, y) for x in range(-1, 2) for y in range(-1, 2)]\n",
    "            surrounding_crd.remove((0, 0))\n",
    "            sumOfEight = 0\n",
    "            for coordinate in surrounding_crd:\n",
    "                sumOfEight += large_matrix[i + coordinate[0], j + coordinate[1]]\n",
    "            large_matrix[i, j] = sumOfEight/8"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
